#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/loggedTemplate.xhtml">
	 
	<f:metadata>
		<f:event type="preRenderView"
			listener="${symbol_pound}{livroBean.loadDataModel}" />
	</f:metadata>
	
	<ui:define name="content">
		
		<h1>${symbol_pound}{msg['livro.titulo.lista']}</h1>
		
		<h:form id="livroForm">
			
			<p:messages />
			<div>
				<p:commandButton value="${symbol_pound}{msg['botao.criar']}" action="${symbol_pound}{livroBean.criar}" />
			</div>
			<p:dataTable var="livro" value="${symbol_pound}{livroBean.dataModel}"
				paginator="true" rows="${symbol_pound}{livroBean.pageSize}" emptyMessage="${symbol_pound}{msg['dataModel.lista.vazia']}"
				paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
				rowsPerPageTemplate="5,10,15" selectionMode="single" rowKey="${symbol_pound}{livro.id}"
				selection="${symbol_pound}{livroBean.entidade}" id="dataModel" lazy="true">

				<p:column headerText="${symbol_pound}{msg['livro.titulo']}" sortBy="${symbol_pound}{livro.titulo}"
					filterBy="${symbol_pound}{livro.titulo}">
					<h:outputText value="${symbol_pound}{livro.titulo}" />
				</p:column>

				<p:column headerText="${symbol_pound}{msg['livro.isbn']}" sortBy="${symbol_pound}{livro.isbn}"
					filterBy="${symbol_pound}{livro.isbn}">
					<h:outputText value="${symbol_pound}{livro.isbn}" />
				</p:column>
				
				<p:column headerText="${symbol_pound}{msg['dataModel.coluna.acoes']}">
					<p:commandButton value="${symbol_pound}{msg['botao.editar']}" action="${symbol_pound}{livroBean.editar}" />
					<p:commandButton value="${symbol_pound}{msg['botao.remover']}" action="${symbol_pound}{livroBean.remover}" />
				</p:column>

			</p:dataTable>

		</h:form>

	</ui:define>
</ui:composition>
